c2a57d6086b4106f20c29019d0c044d406b79c9a,tool/src/java/org/sakaiproject/evaluation/tool/reporting/PDFReportExporter.java,PDFReportExporter,buildReport,#EvalEvaluation#String[]#OutputStream#,98

Before Change


        for (TemplateItemGroup tig : tidl.getTemplateItemGroups()) {
            
            if (!instructorViewAllResults   // If the eval is so configured,
              && !commonLogic.isUserAdmin(currentUserId) // and currentUser is not an admin
              && !currentUserId.equals(evalOwner) // and currentUser is not the eval creator
              && !EvalConstants.ITEM_CATEGORY_COURSE.equals(tig.associateType) 
              && !currentUserId.equals(commonLogic.getEvalUserById(tig.associateId).userId) ) {

After Change


        String currentUserId = commonLogic.getCurrentUserId();
        String evalOwner = evaluation.getOwner();

        boolean isCurrentUserAdmin = commonLogic.isUserAdmin(currentUserId);

        Boolean useBannerImage = (Boolean) evalSettings.get(EvalSettings.ENABLE_PDF_REPORT_BANNER);
        byte[] bannerImageBytes = null;
        if (useBannerImage != null && useBannerImage == true) {
            String bannerImageLocation = (String) evalSettings
                    .get(EvalSettings.PDF_BANNER_IMAGE_LOCATION);
            if (bannerImageLocation != null) {
                bannerImageBytes = commonLogic.getFileContent(bannerImageLocation);
            }
        }

        //EvalUser user = commonLogic.getEvalUserById(commonLogic.getCurrentUserId());

        DateFormat df = DateFormat.getDateInstance(DateFormat.LONG);

        // calculate the response rate
        // int responsesCount = deliveryService.countResponses(evaluation.getId(), null, true);
        int responsesCount = evaluationService.countResponses(null, new Long[] {evaluation.getId()}, groupIds, null);
        int enrollmentsCount = evaluationService.countParticipantsForEval(evaluation.getId(), groupIds);

        String groupNames = responseAggregator.getCommaSeparatedGroupNames(groupIds);

        // TODO this is so hard to read it makes me cry, it should not be written as a giant single line like this -AZ
        evalPDFReportBuilder.addTitlePage(
                evaluation.getTitle(), 
                groupNames, 
                messageLocator.getMessage("reporting.pdf.startdatetime", df.format(evaluation.getStartDate())),
                messageLocator.getMessage("reporting.pdf.enddatetime", df.format(evaluation.getDueDate())), 
                messageLocator.getMessage("reporting.pdf.replyrate", new String[] { 
                        EvalUtils.makeResponseRateStringFromCounts(responsesCount, enrollmentsCount) 
                }), 
                bannerImageBytes, 
                messageLocator.getMessage("reporting.pdf.defaultsystemname")
                );
        
        /**
         * set title and instructions
         * 
         * Note this doesn't go far enough
         * commonLogic.makePlainTextFromHTML removes html tags
         * but it also leaves the text
         */
        evalPDFReportBuilder.addIntroduction(evaluation.getTitle(), 
                htmlContentParser(
                        commonLogic.makePlainTextFromHTML(
                                evaluation.getInstructions())));

        // Reset question numbering
        displayNumber = 0;

        // 1 Make TIDL
        TemplateItemDataList tidl = responseAggregator.prepareTemplateItemDataStructure(evaluation.getId(), groupIds);

        // Loop through the major group types: Course Questions, Instructor Questions, etc.
        for (TemplateItemGroup tig : tidl.getTemplateItemGroups()) {
            
            if (!instructorViewAllResults   // If the eval is so configured,
              && !isCurrentUserAdmin // and currentUser is not an admin
              && !currentUserId.equals(evalOwner) // and currentUser is not the eval creator
              && !EvalConstants.ITEM_CATEGORY_COURSE.equals(tig.associateType) 
              && !currentUserId.equals(commonLogic.getEvalUserById(tig.associateId).userId) ) {